<style type="text/css">

	/* 里面的图标 */
	.el-checkbox__inner {
		display: inline-block;
		position: relative;
		border: 1px solid #000;
		/*border-radius: 2px;*/
		box-sizing: border-box;
		width: 16px;
		height: 16px;
		background-color: #fff;
		z-index: 1;
		vertical-align: top;
		-webkit-transition: border-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46), background-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46);
		transition: border-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46), background-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46);
	}

	.el-checkbox__inner::after {
		box-sizing: content-box;
		content: "";
		border: 2px solid #32a3ce;
		border-left: 0;
		border-top: 0;
		height: 7px;
		left: 5px;
		position: absolute;
		top: 1px;
		-webkit-transform: rotate(45deg) scaleY(0);
		-ms-transform: rotate(45deg) scaleY(0);
		transform: rotate(45deg) scaleY(0);
		width: 3px;
		-webkit-transition: -webkit-transform .05s ease-in .01s;
		transition: -webkit-transform .05s ease-in .01s;
		transition: transform .05s ease-in .01s;
		transition: transform .05s ease-in .01s, -webkit-transform .05s ease-in .01s;
		-webkit-transform-origin: center;
		-ms-transform-origin: center;
		transform-origin: center;
	}

	.el-checkbox__inner.is-checked {
		background-color: transparent;
		border-color: #32a3ce;
	}

	.sensorModuleBox .el-checkbox__inner.is-checked~span,
	.GPSModuleBox .el-checkbox__inner.is-checked~span {
		color: #d15b47;
	}

	.el-checkbox__inner.is-checked::after {
		-webkit-transform: rotate(45deg) scaleY(1);
		-ms-transform: rotate(45deg) scaleY(1);
		transform: rotate(45deg) scaleY(1);
	}
</style>
<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['系统配置','固件管理[项目]']" icon="fa fa-cog"
			class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span>
					<h2>固件管理[项目]</h2>
				</header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<div class="top_module">
									<span class="module_text">所属公司</span>
									<sa-company-tree companyTreeId="companyTree"
										(companySelected)="companySelected($event)"></sa-company-tree>
								</div>
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">车辆用途
									</span><select class="top_module_select select2" id="TcarTypeSelect2" name="carUseType" select2>
										<option value="">全部</option>
										<optgroup *ngFor="let item of carTypeList" [label]="item.label">
											<option *ngFor="let lis of item.children" [value]='lis.id'>{{lis.label}}</option>
										</optgroup>
									</select>
								</div>

								<div class="top_module">
									<span class="module_text">硬件版本</span>
									<select name="" class="top_module_select" [(ngModel)]="hwVersion">
									  <option value="">全部</option>
									  <option value="" *ngFor="let item of hwVersionList" [value]="item.number">{{ item.text }}</option>
									</select>
								  </div>

								<div class="top_module">
									<span class="module_text">通道数</span>
									<select name="" class="top_module_select" [(ngModel)]="sensorNum">
									  <option value="">全部</option>
									  <option value="" *ngFor="let item of sensorNumList" [value]="item.number">{{ item.text }}</option>
									</select>
								  </div>

								<button class="btn btn-primary" (click)="table_search()" style="margin-left: 8px;">查询</button>
								<button type="button" class="btn btn-primary" (click)="new_scheduling()">添加</button>

								<button type="button" class="btn btn-primary" (click)="firmReplace(firmReplaceModal)">固件替换</button>
							</div>
							<div class="right top-search">
								<input type="text" [(ngModel)]="searchKey" (change)="table_search()" class="search-input"
									placeholder="所属公司/固件名称/版本号">
								<span class="top-search-box">
									<button class="top-search-btn" type="button" (click)="table_search()"> <i
											class="fa fa-search"></i></button>
								</span>
							</div>
						</div>
						<div class="table_scroll">
							<table
								class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>所属公司</th>
										<th>车辆用途</th>
										<th>硬件版本</th>
										<th>通道数</th>
										<th>固件名称</th>
										<th>版本号</th>
										<th>描述</th>
										<th>包个数</th>
										<th>大小(字节)</th>
										<th>更新时间</th>
										<th>更新人员</th>
										<th>系数设置</th>
										<th>升级设置[系数设置不成功]</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData">
										<td>{{row.companyName}}</td>
										<td>{{row.useTypeL2}}</td>
										<td>
											<span *ngIf="row.hwVersion == 4">V4</span>
											<span *ngIf="row.hwVersion == 5">V5</span>
											<span *ngIf="row.hwVersion == 7">V7</span>
											<span *ngIf="row.hwVersion == 8">V8</span>
											<span *ngIf="row.hwVersion == 9">V9</span>
											<span *ngIf="row.hwVersion == 10">V10</span>
										</td>
										<td>
											<span *ngIf="row.sensorNum == -1">默认</span>
											<span *ngIf="row.sensorNum == 1">1通道</span>
											<span *ngIf="row.sensorNum == 2">2通道</span>
											<span *ngIf="row.sensorNum == 3">3通道</span>
											<span *ngIf="row.sensorNum == 4">4通道</span>
										</td>
										<td>{{row.binName}}</td>
										<td>{{row.version}}</td>
										<td>{{row.description}}</td>
										<td>{{row.packetTotal}}</td>
										<td>{{row.binSize}}</td>
										<td>{{row.updateDate}}</td>
										<td>{{row.updateUserName}}</td>
										<td>
											<span *ngIf="row.coefSetStatus == 0">默认系数</span>
											<span *ngIf="row.coefSetStatus == 2">取消系数</span>
											<span *ngIf="row.coefSetStatus == 1">固定系数
												<span>[{{row.coef}}]</span>
											</span>
										</td>
										<td>
											<span *ngIf="row.upgradeSetStatus == 0">允许升级</span>
											<span *ngIf="row.upgradeSetStatus == 1">不允许升级</span>
										</td>
										<td>
											<button type="button" (click)="coefConfig(row,coefConfigModal)">设置系数</button>
											<button type="button" (click)='updateConfig(row,updateConfigModal)'>升级设置</button>
											<button type="button" (click)='deleteConfig(row)'>删除</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount" [rows]="pageSize" [currentPage]="curPage - 1"
								(onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i
									class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
	<!--系数设置    弹窗start-->
	<section bsModal #coefConfigModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
		aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="closeCoefConfig(coefConfigModal)" aria-label="Close"><span
							aria-hidden="true">&times;</span></button>
					<h4 class="modal-title">设置系数</h4>
				</div>
				<div class="modal-body row">
					<div class="">
						<span class="text" style="vertical-align: middle;margin-right: 24px;">系数类型</span>
						<label class="radio radio-inline" style="margin-top: 0;">
							<input type="radio" class="radiobox" [(ngModel)]='coefParam.coefSetStatus'
								(change)="coefConfigTypeChange($event.target.value)" value="0" name="defaultCoef">
							<span>默认系数</span>
						</label>
						<label class="radio radio-inline">
							<input type="radio" class="radiobox" [(ngModel)]='coefParam.coefSetStatus'
								(change)="coefConfigTypeChange($event.target.value)" value="1" name="coef">
							<span>固定系数</span>
						</label>
						<label class="radio radio-inline">
							<input type="radio" class="radiobox" [(ngModel)]='coefParam.coefSetStatus'
								(change)="coefConfigTypeChange($event.target.value)" value="2" name="cancelCoef">
							<span>取消设置</span>
						</label>
					</div>
					<div *ngIf="coefParam.coefSetStatus ==='1'" style="margin-top: 12px;">
						<div class="profile-info-row col-xs-6" *ngFor="let item of coefficientList;">
							<div class="profile-info-name"> Channel {{item.index}}</div>
							<div class="profile-info-value">
								<input [(ngModel)]='item.coef' type="text" class="input form-control" [ngClass]='{green:item.coef!==0}'>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer" style="position: relative;height: 84px;line-height: 43px;">
					<div class="description"
						style="position: absolute;left: 12px;top: 8px;text-align: left;color: #999;font-size: 12px;line-height: normal;">
						<p>说明：</p>
						<p>默认系数：升级固件前，按传感器通道前后轴规则，写入默认系数</p>
						<p>固定系数：升级固件前，按配置的系数写入</p>
						<p>取消设置：升级固件前，不写入系数</p>
					</div>
					<button type="button" class="btn btn-default" (click)="closeCoefConfig(coefConfigModal)">取消</button>
					<button type="button" class="btn btn-primary" (click)="submitCoefConfig(coefConfigModal)">提交</button>
				</div>
			</div>
		</div>
	</section>
	<!--系数设置    弹窗end-->

	<!--升级设置    弹窗start-->
	<section bsModal #updateConfigModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
		aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="closeUpdateConfig(updateConfigModal)" aria-label="Close"><span
							aria-hidden="true">&times;</span></button>
					<h4 class="modal-title">固件升级设置</h4>
				</div>
				<div class="modal-body row">
					<div class="">
						<span class="text" style="vertical-align: middle;margin-right: 24px;">升级设置</span>
						<label class="radio radio-inline" style="margin-top: 0;">
							<input type="radio" class="radiobox" [(ngModel)]='updateParam.upgradeSetStatus'
								(change)="updateConfigTypeChange($event.target.value)" value="0" name="update">
							<span>系数设置不成功-允许升级固件</span>
						</label>
						<label class="radio radio-inline">
							<input type="radio" class="radiobox" [(ngModel)]='updateParam.upgradeSetStatus'
								(change)="updateConfigTypeChange($event.target.value)" value="1" name="notUpdata">
							<span>系数设置不成功-不允许升级固件</span>
						</label>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" (click)="closeUpdateConfig(updateConfigModal)">取消</button>
					<button type="button" class="btn btn-primary" (click)="submitUpdateConfig(updateConfigModal)">提交</button>
				</div>
			</div>
		</div>
	</section>
	<!--升级设置    弹窗end-->

	<!--固件替换    弹窗start-->
	<section bsModal #firmReplaceModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
		aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="closeCoefConfig(firmReplaceModal)" aria-label="Close"><span
							aria-hidden="true">&times;</span></button>
					<h4 class="modal-title">固件替换</h4>
				</div>
				<div class="modal-body">
					<div class="row form-horizontal">
						<div class="form-group col-xs-12" >
							<label class="control-label col-sm-4 no-padding-right">固件版本（替换前）<sup>*</sup></label>
							<div class="col-sm-8">
								<input type="hidden" class="form-control" name='binBeforeSelect2' [(ngModel)]='binFrom.binIdBefore'>
								<div class="s_hover_box" style="width:100%" >
									<select class="select2 form-control" id="binBeforeSelect2" style="width:100%">
										<option value=''></option>
									</select>
									<div class="s_del_icon" (click)='delBin("binBeforeSelect2")'>x</div>
								</div>
							</div>
						</div>

						<div class="form-group col-xs-12" >
							<label class="control-label col-sm-4 no-padding-right">固件版本（替换后）<sup>*</sup></label>
							<div class="col-sm-8">
								<input type="hidden" class="form-control" name='binIdAfterSelect2' [(ngModel)]='binFrom.binIdAfter'>
								<div class="s_hover_box" style="width:100%" >
									<select class="select2 form-control" id="binIdAfterSelect2" style="width:100%">
										<option value=''></option>
									</select>
									<div class="s_del_icon" (click)='delBin("binIdAfterSelect2")'>x</div>
								</div>
							</div>
						</div>
						<div class="form-group col-xs-12">
							<label class="control-label col-sm-2 no-padding-right"></label>
							<div class="col-sm-10" (click)="resetSelectClick()" style="width: 45%;">
								<span class="el-checkbox__inner" [ngClass]="{'is-checked':isResetSelected}"></span>
								<span>替换记录共: &nbsp; {{replaceBinNum}} 条</span>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer" style="position: relative;height: 84px;line-height: 43px;">
					<button type="button" class="btn btn-default" (click)="closeCoefConfig(firmReplaceModal)">取消</button>
					<button type="button" class="btn btn-primary" (click)="submitReplaceCommit(firmReplaceModal)">提交</button>
				</div>
			</div>
		</div>
	</section>
	<!--固件替换    弹窗end-->
</div>